package lc_剑指_Offer_II_089_房屋偷盗;

public class Solution {
	public int rob(int[] nums) {
		int s = nums[0], p = 0, cs = 0, cp = 0;
		for (int i = 1; i < nums.length; i++, s = cs, p = cp) {
			cs = p + nums[i];
			cp = Math.max(s, p);
		}
		return Math.max(s, p);
	}
}